package cn.aitrox.ry.service.anno.enumtype.task;

public enum TaskStatusEnum {

    NOT_START(0, "未开始"),

    PROCESSING(1, "进行中"),

    COMPLETE(2, "已完成"),

    TERMINATE(3, "终结");

    private Integer status;

    private String desc;

    TaskStatusEnum(Integer status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public Integer getStatus() {
        return status;
    }

    public String getDesc() {
        return desc;
    }

    public static TaskStatusEnum getEnumByStatus(Integer status) {
        if (null == status) {
            return null;
        }
        for (TaskStatusEnum statusEnum : TaskStatusEnum.values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static Boolean isProcessing(Integer status) {
        return PROCESSING.getStatus().equals(status);
    }

    public static Boolean isNotStart(Integer status) {
        return NOT_START.getStatus().equals(status);
    }

    public static boolean _isEnd(Integer status) {
        return COMPLETE.getStatus().equals(status) || TERMINATE.getStatus().equals(status);
    }

}
